import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'

const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function (loction) {
  return originalPush.call(this, loction).catch(err => { })
};
Vue.use(VueRouter)

const routes = [
  {
    path: "/",
    redirect: "/home"
  },
  {
    path: '/home',
    name: 'home',
    component: HomeView
  },
  {
    path: '/goods',
    component: () => import( '../views/Goods.vue')
  },
  {
    path: '/user',
    component: () => import( '../views/User.vue')
  },
  {
    path: '/details',
    component: () => import('../views/Details.vue')
  }
]

const router = new VueRouter({
  routes
})

export default router
